Skip to content

CAMEL-24624: camel-infinispan - catalog, lifecycle and efficiency cleanups - #26113

Open
oscerd wants to merge 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24624
Open

CAMEL-24624: camel-infinispan - catalog, lifecycle and efficiency cleanups#26113
oscerd wants to merge 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24624

Conversation

@oscerd

@oscerd oscerd commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Five small items found while auditing components/camel-infinispan, grouped because each is a couple of
lines.

1. CamelInfinispanOperationResult is a phantom header — deprecated

InfinispanConstants#RESULT has zero readers or writers in main or test sources, yet it is published in
both infinispan.json and infinispan-embedded.json and rendered throughout the docs — with the
description of CamelInfinispanOperationResultHeader, which is the option that actually names the result
header. So the docs advertised two headers for one job and the more obvious-looking one did nothing.

History explains it: when the QUERY operation was contributed in CAMEL-9624 (2016) the result was read
from this header. It became dead when setResult moved to RESULT_HEADER/the message body.

The constant is kept and marked @Deprecated with a deprecationNote rather than deleted, so nothing that
imports it stops compiling. Upgrade note added for 4.23.

2. CamelInfinispanIgnoreReturnValues was labelled a consumer header

It is read on the producer path — InfinispanEmbeddedManager#getCache(Message, String) — and its
description ("a write operation's return value") is producer semantics. Only its group in the catalog and
the docs changes.

3. Consumer stop order

InfinispanRemoteConsumer and InfinispanEmbeddedConsumer both called super.doStop() before stopping
the handler that owns the cache listener, the reverse of doStart(). An event arriving between the two
calls was processed against a consumer that was already stopped. Now the listener goes first.

4. Idempotent repository: one round trip instead of two

// before
if (getCache().containsKey(key)) {
    return false;
}
Boolean put = getCache().put(key, true);
return put == null;

// after
return getCache().putIfAbsent(key, true) == null;

Same outcome, atomic, and it still leaves the lifespan of an existing entry untouched, which is what the
original comment was protecting. It halves the network round trips of every idempotency check on the Hot Rod
repository. The remote cache is obtained with Flag.FORCE_RETURN_VALUE (CAMEL-9840), so the previous value
is reported and the == null test is sound there too.

5. Typos

"Cannot remote the listener"remove; "InifinispanConfiguration"InfinispanConfiguration (the
latter is user-visible, it is in the CamelInfinispanQueryBuilder header description).

Verification

mvn clean install on components/camel-infinispan is green — 110 tests, including the Hot Rod
integration tests against a testcontainer and both Spring idempotent-repository ITs, which exercise the
putIfAbsent change end to end. Full reactor mvn clean install -DskipTests -Dquickly green; catalog and
endpoint-DSL descriptors regenerated and committed (the DSL regeneration needs a build without -Dquickly).


Claude Code on behalf of oscerd

🤖 Generated with Claude Code

…anups

Five small items found while auditing the component.

The CamelInfinispanOperationResult header is deprecated. It has had no reader or
writer since the remote and embedded components were split, yet it was published
in both catalogs and rendered in the docs with the description of
CamelInfinispanOperationResultHeader, which is the option that actually names
the result header.

CamelInfinispanIgnoreReturnValues is documented as a producer header. It is read
on the producer path, in InfinispanEmbeddedManager#getCache(Message, String),
and its description is producer semantics, so it was in the wrong group.

Both consumers now stop the handler that owns the cache listener before calling
super.doStop(), the reverse of doStart(). An event arriving between the two
calls used to be processed against a consumer that was already stopped.

The idempotent repository uses putIfAbsent instead of containsKey followed by
put. The outcome is the same, it is atomic, it leaves the lifespan of an
existing entry untouched, and it halves the round trips of every check. The
remote cache forces return values since CAMEL-9840, so the previous value is
always reported.

Two typos: "Cannot remote the listener" and "InifinispanConfiguration".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JpshGTyfSmdq7hC8tuEwrZ
@oscerd
oscerd requested review from davsclaus and gnodet September 4, 2026 08:39
@oscerd oscerd added the task label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid cleanup — five distinct improvements, all correct.

  1. CamelInfinispanOperationResult deprecation — confirmed dead since the remote/embedded split. Keeping the constant with @Deprecated preserves binary compatibility, and the deprecationNote guides users to CamelInfinispanOperationResultHeader.

  2. CamelInfinispanIgnoreReturnValues label correction — confirmed it's read on the producer path (InfinispanEmbeddedManager#getCache(Message, String)). The consumer label was always wrong.

  3. Consumer stop-order fix — correctly mirrors doStart() (handler stopped before super.doStop()), closing the window where events could be dispatched to a stopped consumer. Applied consistently to both InfinispanRemoteConsumer and InfinispanEmbeddedConsumer.

  4. putIfAbsent optimization — semantically equivalent to the original containsKey+put pair, atomic, halves round trips. The == null test is sound: the remote repository uses Flag.FORCE_RETURN_VALUE (set in InfinispanRemoteIdempotentRepository.doStart()), and the embedded Cache implements ConcurrentMap which inherently returns the previous value. Also closes a subtle TOCTOU race in the original code.

  5. Typo fixesremoteremove, InifinispanConfigurationInfinispanConfiguration.

Upgrade guide is accurate and appropriately scoped (covers API-visible changes only).

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-infinispan/camel-infinispan-common
  • components/camel-infinispan/camel-infinispan-embedded
  • components/camel-infinispan/camel-infinispan
  • docs
  • dsl/camel-endpointdsl

🔬 Scalpel shadow comparison — Scalpel: 16 tested, 24 compile-only — current: 13 all tested

Maveniverse Scalpel detected 40 affected modules (current approach: 13).

⚠️ Modules only in Scalpel (27)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 16 modules (6 direct + 10 downstream), skip tests for 24 (generated code, meta-modules)

Modules Scalpel would test (16)
  • camel-catalog
  • camel-endpointdsl
  • camel-infinispan
  • camel-infinispan-common
  • camel-infinispan-embedded
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-langchain4j-embeddings
  • camel-langchain4j-embeddingstore
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
  • docs
Modules with tests skipped (24)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • components/camel-infinispan/camel-infinispan: 2 test(s) disabled on GitHub Actions
All tested modules (40 modules)
  • Camel :: AI :: LangChain4j :: Embedding
  • Camel :: AI :: LangChain4j :: EmbeddingStore
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Infinispan :: Common
  • Camel :: Infinispan :: Embedded
  • Camel :: Infinispan :: Remote
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants